# @Version        : 1.0
# @Update Time    : 2024/9/21 10:09
# @File           : post_schema.py
# @IDE            : PyCharm
# @Desc           : 岗位模型
from typing import Optional, Literal

from fastapi_utils.api_model import APIModel
from pydantic import Field
from src.schemas.base_schema import MixinSchema
from fastapi import Depends
from src.core.dependencies import QueryParams, Paging


class PostParams(QueryParams):
    def __init__(
        self,
        params: Paging = Depends(Paging),
    ):
        super().__init__(params)


class PostCreate(APIModel):
    post_code: Optional[str] = Field(default=None, description="岗位编码")
    post_name: Optional[str] = Field(default=None, description="岗位名称")
    post_sort: Optional[int] = Field(default=None, description="显示顺序")
    remark: Optional[str] = Field(default=None, description="备注")
    status: Optional[Literal["1", "2"]] = Field(
        default="1", description="是否启用1:启用，2:禁用"
    )


class PostUpdate(PostCreate):
    id: int = Field(description="岗位ID")


class PostOut(MixinSchema, PostCreate):
    pass


class PostOptions(APIModel):
    value: int = Field(default=None, description="岗位编码")
    label: str = Field(default=None, description="岗位名称")
